public class Test2 {
    //fibonacci()是在计算斐波那契的第n项
    //这里默认n>=1
    public int fibonacci(int n){
        if(n<=1) return 1;
        int[] fibarr = new int[n+1];
        fibarr[0]=1;
        fibarr[1]=1;
        for (int i = 2; i < n; i++) {
            fibarr[i]= fibarr[i-1]+fibarr[i-2];
        }
        return fibarr[n-1];
    }




    //计算func1的空间复杂度
    public void func1(int[] arr){
        for (int i = 0; i < arr.length-1; i++) {
            Boolean is = false;
            for (int j=0;j< arr.length-i-1;j++){
                if (arr[j]>arr[j+1]){
                    int tmp = arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=tmp;
                    is=true;
                }
            }
            if (is==false){
                break;
            }
        }
    }
}
